package com.mc.read.pcApi.controller;

import com.mc.read.pcApi.service.MainInfoService;
import com.mc.read.pcApi.service.MainService;
import com.mc.read.vo.request.BaseRequest;
import com.mc.read.vo.respose.BaseRespose;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Author:LiuHao
 * @Date:14:30 2019/5/30
 * 主页controller
 **/
@Controller
@RequestMapping(value = "/verify/main/")
@Slf4j
public class MainController {
    @Autowired
    MainService mainService;
    @Autowired
    MainInfoService mainInfoService;

    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 查询该书籍所有标签列表 selectBookLabelList
     **/
    @ResponseBody
    @RequestMapping(value = "selectBookLabelList", method = RequestMethod.POST)
    public BaseRespose selectBookLabelList(@RequestBody BaseRequest baseRequest) {
        BaseRespose baseRespose = mainService.selectBookLabelList(baseRequest);
        return baseRespose;
    }

    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 用户给书籍标签点赞 userGiveLike
     **/
    @ResponseBody
    @RequestMapping(value = "userGiveLike", method = RequestMethod.POST)
    public BaseRespose userGiveLike(@RequestBody BaseRequest baseRequest) {
        BaseRespose baseRespose = mainService.userGiveLike(baseRequest);
        return baseRespose;
    }

    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 用户给书籍标签狂踩 userGivehate
     **/
    @ResponseBody
    @RequestMapping(value = "userGivehate", method = RequestMethod.POST)
    public BaseRespose userGivehate(@RequestBody BaseRequest baseRequest) {
        BaseRespose baseRespose = mainService.userGivehate(baseRequest);
        return baseRespose;
    }

    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 用户给该书籍添加标签 userAddLabel
     **/
    @ResponseBody
    @RequestMapping(value = "userAddLabel", method = RequestMethod.POST)
    public BaseRespose userAddLabel(@RequestBody BaseRequest baseRequest) {
        BaseRespose baseRespose = mainService.userAddLabel(baseRequest);
        return baseRespose;
    }

    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 小说书籍查询 selectBookList
     **/
//    @ResponseBody
//    @RequestMapping(value = "selectBookList", method = RequestMethod.POST)
//    public BaseRespose selectBookList(@RequestBody BaseRequest baseRequest) {
//        BaseRespose baseRespose = mainService.selectBookList(baseRequest);
//        return baseRespose;
//    }


    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 查询主页信息 selectMainInfo
     **/
    @ResponseBody
    @RequestMapping(value = "selectMainInfo", method = RequestMethod.POST)
    public BaseRespose selectMainInfo(@RequestBody BaseRequest baseRequest) {
        BaseRespose baseRespose = mainInfoService.selectMainInfo(baseRequest);
        return baseRespose;
    }

    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 推荐小说查询（换一批） selectOtherRecBook
     **/
    @ResponseBody
    @RequestMapping(value = "selectOtherRecBook", method = RequestMethod.POST)
    public BaseRespose selectOtherRecBook(@RequestBody BaseRequest baseRequest) {
        BaseRespose baseRespose = mainInfoService.selectOtherRecBook(baseRequest);
        return baseRespose;
    }

    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 用户对书籍二级菜单选举 addSecondLevel
     **/
    @ResponseBody
    @RequestMapping(value = "addSecondLevel", method = RequestMethod.POST)
    public BaseRespose addSecondLevel(@RequestBody BaseRequest baseRequest) {
        BaseRespose baseRespose = mainService.addSecondLevel(baseRequest);
        return baseRespose;
    }

    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 增加用户阅读时长 addUserReadTime
     **/
    @ResponseBody
    @RequestMapping(value = "addUserReadTime", method = RequestMethod.POST)
    public BaseRespose addUserReadTime(@RequestBody BaseRequest baseRequest) {
        BaseRespose baseRespose = mainInfoService.addUserReadTime(baseRequest);
        return baseRespose;
    }

    /**
     * @Author:LiuHao
     * @Date:15:24 2019/7/01
     * 根据类型和标签搜索书籍 selectBookByTypeAndLabel
     **/
    @ResponseBody
    @RequestMapping(value = "selectBookByTypeAndLabel", method = RequestMethod.POST)
    public BaseRespose selectBookByTypeAndLabel(@RequestBody BaseRequest baseRequest) {
        BaseRespose baseRespose = mainInfoService.selectBookByTypeAndLabel(baseRequest);
        return baseRespose;
    }

}
